{
temp_path = g_build_filename (priv->path, basename, NULL);
rel_temp_path = g_strconcat ("./", basename, NULL);
- temp_copy = ot_util_new_file_for_path (temp_path);
+ temp_copy = ot_gfile_new_for_path (temp_path);
if (!g_file_copy (trigger, temp_copy, 0, NULL, NULL, NULL, error))
goto out;
GFileEnumerator *enumerator = NULL;
triggerdir_path = g_build_filename (LIBEXECDIR, "ostree", "triggers.d", NULL);
- triggerdir = ot_util_new_file_for_path (triggerdir_path);
+ triggerdir = ot_gfile_new_for_path (triggerdir_path);
enumerator = g_file_enumerate_children (triggerdir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
if (type == G_FILE_TYPE_REGULAR && g_str_has_suffix (name, ".trigger"))
{
child_path = g_build_filename (triggerdir_path, name, NULL);
- child = ot_util_new_file_for_path (child_path);
+ child = ot_gfile_new_for_path (child_path);
success = check_trigger (self, child, error);
}
GChecksum *ret_checksum = NULL;
GFileOutputStream *out = NULL;
- file = ot_util_new_file_for_path (path);
- dest_file = ot_util_new_file_for_path (dest_path);
+ file = ot_gfile_new_for_path (path);
+ dest_file = ot_gfile_new_for_path (dest_path);
if (out_checksum)
ret_checksum = g_checksum_new (G_CHECKSUM_SHA256);
guint64 content_len;
gsize bytes_read;
- file = ot_util_new_file_for_path (path);
+ file = ot_gfile_new_for_path (path);
if (!ostree_parse_packed_file (file, &metadata, &in, NULL, error))
goto out;
mode = GUINT32_FROM_BE (mode);
content_len = GUINT64_FROM_BE (content_len);
- dest_file = ot_util_new_file_for_path (dest_path);
+ dest_file = ot_gfile_new_for_path (dest_path);
if (out_checksum)
ret_checksum = g_checksum_new (G_CHECKSUM_SHA256);
checksum = _ostree_repo_file_get_checksum (self);
path = ostree_repo_get_object_path (self->repo, checksum, OSTREE_OBJECT_TYPE_FILE);
- ret = ot_util_new_file_for_path (path);
+ ret = ot_gfile_new_for_path (path);
g_free (path);
return ret;
GFile *ret;
path = ostree_repo_get_object_path (repo, checksum, OSTREE_OBJECT_TYPE_FILE);
- ret = ot_util_new_file_for_path (path);
+ ret = ot_gfile_new_for_path (path);
g_free (path);
return ret;
g_assert (priv->path != NULL);
- priv->repo_file = ot_util_new_file_for_path (priv->path);
+ priv->repo_file = ot_gfile_new_for_path (priv->path);
priv->tmp_dir = g_file_resolve_relative_path (priv->repo_file, "tmp");
priv->local_heads_dir = g_file_resolve_relative_path (priv->repo_file, "refs/heads");
priv->remote_heads_dir = g_file_resolve_relative_path (priv->repo_file, "refs/remotes");
}
ret = TRUE;
- *out_tmpname = ot_util_new_file_for_path (dest_name);
+ *out_tmpname = ot_gfile_new_for_path (dest_name);
*out_checksum = checksum;
checksum = NULL;
out:
GFile *f = NULL;
GFileInfo *f_info = NULL;
- f = ot_util_new_file_for_path (path);
+ f = ot_gfile_new_for_path (path);
f_info = g_file_query_info (f, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
char *dest_path = NULL;
char *dest_tmp_path = NULL;
- infile = ot_util_new_file_for_path (path);
+ infile = ot_gfile_new_for_path (path);
dest_path = prepare_dir_for_checksum_get_object_path (self, checksum, objtype, error);
if (!dest_path)
dest_tmp_path = g_strconcat (dest_path, ".tmp", NULL);
- outfile = ot_util_new_file_for_path (dest_tmp_path);
+ outfile = ot_gfile_new_for_path (dest_tmp_path);
out = g_file_replace (outfile, NULL, FALSE, 0, NULL, error);
if (!out)
goto out;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_assert (tree != NULL);
- f = ot_util_new_file_for_path (abspath);
+ f = ot_gfile_new_for_path (abspath);
if (!ostree_checksum_file (f, OSTREE_OBJECT_TYPE_FILE, &checksum, NULL, error))
goto out;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (priv->inited, FALSE);
- objectdir = ot_util_new_file_for_path (priv->objects_path);
+ objectdir = ot_gfile_new_for_path (priv->objects_path);
enumerator = g_file_enumerate_children (objectdir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL,
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
path = ostree_repo_get_object_path (self, sha256, OSTREE_OBJECT_TYPE_META);
- f = ot_util_new_file_for_path (path);
+ f = ot_gfile_new_for_path (path);
if (!ostree_parse_metadata_file (f, &ret_type, &ret_variant, error))
goto out;
GVariant *xattr_variant = NULL;
dest_path = g_build_filename (destination, dirname, NULL);
- dest_file = ot_util_new_file_for_path (dest_path);
+ dest_file = ot_gfile_new_for_path (dest_path);
if (!_ostree_repo_file_get_xattrs (dir, &xattr_variant, NULL, error))
goto out;
GError *temp_error = NULL;
gboolean ret = FALSE;
- dir = ot_util_new_file_for_path (path);
+ dir = ot_gfile_new_for_path (path);
if (with_parents)
ret = g_file_make_directory_with_parents (dir, NULL, &temp_error);
else
GFile *file = NULL;
char *ret = NULL;
- file = ot_util_new_file_for_path (path);
+ file = ot_gfile_new_for_path (path);
if (!ot_util_gfile_load_contents_utf8 (file, NULL, &ret, NULL, error))
goto out;
/* Like g_file_new_for_path, but only do local stuff, not GVFS */
GFile *
-ot_util_new_file_for_path (const char *path)
+ot_gfile_new_for_path (const char *path)
{
return g_vfs_get_file_for_path (g_vfs_get_local (), path);
}
G_BEGIN_DECLS
-GFile *ot_util_new_file_for_path (const char *path);
+GFile *ot_gfile_new_for_path (const char *path);
const char *ot_gfile_get_path_cached (GFile *file);
GFileOutputStream *ret_log = NULL;
path = g_strdup_printf ("%s/%s.log", tmpdir, name);
- logf = ot_util_new_file_for_path (path);
+ logf = ot_gfile_new_for_path (path);
ret_log = g_file_replace (logf, NULL, FALSE, 0, NULL, error);
if (!ret_log)
goto out;
if (argc > 1)
- f = ot_util_new_file_for_path (argv[1]);
+ f = ot_gfile_new_for_path (argv[1]);
else
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
}
else if (metadata_bin_path)
{
- metadata_f = ot_util_new_file_for_path (metadata_bin_path);
+ metadata_f = ot_gfile_new_for_path (metadata_bin_path);
if (!ot_util_variant_map (metadata_f, G_VARIANT_TYPE ("a{sv}"), &metadata, error))
goto out;
}
out = (GOutputStream*)g_unix_output_stream_new (pipefd[1], TRUE);
from_fd = pipefd[0];
- fdata.dir = ot_util_new_file_for_path (dir);
+ fdata.dir = ot_gfile_new_for_path (dir);
fdata.separator = separator;
fdata.out = out;
fdata.cancellable = NULL;
if (g_str_has_suffix (destpath, "/"))
destpath[strlen (destpath) - 1] = '\0';
branchpath = g_strconcat (destpath, "-tmp-checkout-", branchrev, NULL);
- branchf = ot_util_new_file_for_path (branchpath);
+ branchf = ot_gfile_new_for_path (branchpath);
g_print ("Checking out %s (commit %s)...\n", branch, branchrev);
if (!ostree_repo_checkout (repo, branchrev, branchpath, NULL, error))
}
destination = argv[1];
- destf = ot_util_new_file_for_path (destination);
+ destf = ot_gfile_new_for_path (destination);
if (compose_metadata_path)
{
"ostree-compose", g_variant_builder_end (&compose_metadata_builder));
compose_metadata_builder_initialized = FALSE;
- metadata_f = ot_util_new_file_for_path (compose_metadata_path);
+ metadata_f = ot_gfile_new_for_path (compose_metadata_path);
commit_metadata = g_variant_builder_end (&commit_metadata_builder);
if (!ot_util_variant_save (metadata_f, commit_metadata, NULL, error))
|| g_str_has_prefix (arg, "./")
)
{
- ret_file = ot_util_new_file_for_path (arg);
+ ret_file = ot_gfile_new_for_path (arg);
}
else
{
src = argv[1];
target = argv[2];
- cwd = ot_util_new_file_for_path (".");
+ cwd = ot_gfile_new_for_path (".");
if (!parse_file_or_commit (repo, src, &srcf, NULL, error))
goto out;
gsize bytes_read;
char buf[8192];
- file = ot_util_new_file_for_path (path);
+ file = ot_gfile_new_for_path (path);
in = g_file_read (file, NULL, error);
if (!in)
char *dot;
GFile *f = NULL;
- f = ot_util_new_file_for_path (path);
+ f = ot_gfile_new_for_path (path);
/* nlinks = g_file_info_get_attribute_uint32 (file_info, "unix::nlink");
if (nlinks < 2 && !quiet)
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- repodir = ot_util_new_file_for_path (repo_path);
+ repodir = ot_gfile_new_for_path (repo_path);
child = g_file_get_child (repodir, "config");
goto out;
}
close (fd);
- tempf = ot_util_new_file_for_path (template);
+ tempf = ot_gfile_new_for_path (template);
buf = soup_message_body_flatten (msg->response_body);
GFile *f = NULL;
GVariant *variant = NULL;
- f = ot_util_new_file_for_path (filename);
+ f = ot_gfile_new_for_path (filename);
if (!ot_util_variant_map (f, type, &variant, error))
goto out;
path = ostree_repo_get_object_path (repo, checksum, OSTREE_OBJECT_TYPE_FILE);
if (!path)
goto out;
- file = ot_util_new_file_for_path (path);
+ file = ot_gfile_new_for_path (path);
if (!ostree_parse_packed_file (file, &variant, &content, NULL, error))
goto out;